﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;

namespace UtopianGame.graphics.menu
{
    class PreviousButton : MenuButton
    {
        public PreviousButton()
        {
        }

        public PreviousButton(ContentManager cm)
        {
            init(cm);
        }

        protected override void init(ContentManager cm)
        {
            base.init(cm);
            spriteName = "Prev(new)";
            sprite = cm.Load<Texture2D>(spriteName);
            clickable = true;
            boundingBox.Width = sprite.Width;
            boundingBox.Height = sprite.Height;
        }



        protected override void executeFunction()
        {
            if (parentObj is PolicyScreen)
            {
                PolicyScreen parentScreen = (PolicyScreen)parentObj;
                if (parentScreen.currentPolicy > 0)
                {
                    parentScreen.currentPolicy -= 1;
                }
            }
            else if (parentObj is InfrastructureScreen)
            {
                InfrastructureScreen parentScreen = (InfrastructureScreen)parentObj;
                if (parentScreen.currentInfrastructure > 0)
                {
                    parentScreen.currentInfrastructure -= 1;
                }
            }
        }
    }
}
